# 打印1~10
# num = 1
# while num <= 10:
#     print(num)
#     num = num + 1

# 计算 1~100 的和
# num = 1
# sum = 0
# while num <= 100:
#     sum += num
#     num = num + 1
#
# print(f"sum={sum}")

# 计算 5 的阶乘
# i = 1
# res = 1
# while i <= 5:
#     res = res * i
#     i = i + 1
#
# print(res)


# 求 1! + 2! + 3! + 4! + 5!
num = 1
# sum表示最终这几个阶乘累加的结果
sum = 0
while num <= 5:
    # 先计算当前 num! 是多少，然后往 sum上进行累加
    i = 1
    tmp = 1
    while(i <= num):
        tmp = tmp * i
        i = i + 1
    sum += tmp
    num += 1

print(f"sum={sum}")





